package com.szpx.mapper;

import com.szpx.entity.Goods;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;

/**
 * @author June
 * @version 1.0.0
 * @title GoodsMapper
 * @create 2024/3/28 16:34
 * @description
 **/
@org.apache.ibatis.annotations.Mapper
public interface GoodsMapper extends Mapper<Goods> {
    /**
     * 根据Id查询商品信息
     * @param gid
     * @return
     */
    Goods selectByGid(int gid);

    /**
     * 修改商品信息
     * @param goods
     */
    @Update("update tb_goods set url = #{url},price = #{price},title = #{title}," +
            "shop = #{shop},type = #{type} where gid = #{gid}")
    public void update(Goods goods);

    /**
     * 删除商品信息
     */
    @Delete("delete from tb_goods where gid = #{gid}")
    public void deleteById(Integer id);
}
